﻿using System;

namespace Renci.iRods.Common
{
    [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
    internal sealed class PacketFieldAttribute : Attribute
    {
        /// <summary>
        /// Gets the name.
        /// </summary>
        public string XmlName { get; private set; }

        public int Order { get; set; }

        public DataTypes DataType { get; set; }

        public int Length { get; set; }

        public bool IsArray { get; set; }

        public PacketFieldAttribute(string xmlName, int order, DataTypes dataType)
        {
            this.XmlName = xmlName;
            this.Order = order;
            this.DataType = dataType;
        }

        public PacketFieldAttribute(string xmlName, int order, DataTypes dataType, int length)
            : this(xmlName, order, dataType)
        {
            this.Length = length;
        }

        public PacketFieldAttribute(string xmlName, int order, DataTypes dataType, bool isArray)
            : this(xmlName, order, dataType)
        {
            this.IsArray = isArray;
        }
    }
}
